/*
 * @Description: 设计培训管理会、设计策划联合评审会、设计策划启动会、设计管理复盘会、策划会议
 * @Author: wind-lc
 * @version: 1.0
 * @Date: 2021-08-05 10:32:10
 * @LastEditTime: 2023-03-13 16:55:07
 * @FilePath: \cscec-pms-admin\src\api\design\training\index.js
 */
import request from '@/utils/request2'
import { unionApiUrl, safetyApiUrl } from '@/api/config'
export default {
  /**
   * @description: 新增会议
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  insertSelective: data => {
    return request({
      url: `${unionApiUrl}/meeting/insertSelective`,
      method: 'post',
      data
    })
  },
  /**
   * @description: 删除会议
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  deleteByPrimaryKey: id => {
    return request({
      url: `${unionApiUrl}/meeting/deleteByPrimaryKey?id=` + id,
      method: 'post'
    })
  },
  /**
   * @description: 会议列表查询
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  getPageMeeting: data => {
    return request({
      url: `${unionApiUrl}/meeting/getPageMeeting`,
      method: 'post',
      data
    })
  },
  /**
   * @description: 复盘通知
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  replay: data => {
    return request({
      url: `${unionApiUrl}/meeting/replay`,
      method: 'post',
      params: data
    })
  },
  /**
   * @description: 获取会议详情
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  getMeetingById: data => {
    return request({
      url: `${unionApiUrl}/meeting/getMeetingById`,
      method: 'get',
      params: data
    })
  },
  /**
   * @description: 开始会议
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  startMeeting: data => {
    return request({
      url: `${unionApiUrl}/meeting/startMeeting`,
      method: 'get',
      params: data
    })
  },
  /**
   * @description: 更新会议
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */ 
  updateByPrimaryKeySelective: data => {
    try {
      // 过滤id
      const params = JSON.parse(JSON.stringify(data))
      params.picUploadList = params.picUploadList?.map(el => {
        delete el.id
        return el
      }) 
      params.uploadList = params.uploadList?.map(el => {
        delete el.id
        return el
      })
      return request({
        url: `${unionApiUrl}/meeting/updateByPrimaryKeySelective`,
        method: 'post',
        data: params
      })
    } catch (error) {
      console.log(error)
    }
  },
  /**
   * @description: 编辑会议
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */ 
  updateSelective: data => {
    try {
      // 过滤id
      const params = JSON.parse(JSON.stringify(data))
      params.picUploadList = params.picUploadList?.map(el => {
        delete el.id
        return el
      })
      params.uploadList = params.uploadList?.map(el => {
        delete el.id
        return el
      })
      return request({
        url: `${unionApiUrl}/meeting/updateSelective`,
        method: 'post',
        data: params
      })
    } catch (error) {
      console.log(error)
    }
  },
  /**
   * @description: 会议大屏接口
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  meetingScreen: data => {
    return request({
      url: `${unionApiUrl}/meeting/meetingScreen`,
      method: 'get',
      params: data
    })
  },
  /**
   * @description: 获取签到人员
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  getEmployeeSignPage: data => {
    return request({
      url: `${unionApiUrl}/meetingEmployee/getEmployeeSignPage`,
      method: 'post',
      data
    })
  },
  /**
   * @description: 上传策划资料
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  uploadPlanningMaterials: data => {
    return request({
      url: `${unionApiUrl}/meeting/uploadPlanningMaterials`,
      method: 'post',
      data
    })
  },
  /**
   * @description: 新增评审意见
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  addReviewComments: data => {
    return request({
      url: `${unionApiUrl}/meeting/addReviewComments`,
      method: 'post',
      data
    })
  },
  /**
   * @description: 编辑评审意见
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  editReviewComments: data => {
    return request({
      url: `${unionApiUrl}/meeting/editReviewComments`,
      method: 'post',
      data
    })
  },
  /**
   * @description: 评审意见导出
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  getMeetingReviewCommentsExportHtml: data => {
    return request({
      url: `${safetyApiUrl}/leadership-takeshift/getMeetingReviewCommentsExportHtml`,
      method: 'post',
      data
    })
  },
  /**
   * @description: 删除审批意见
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  deleteReviewComments: data => {
    return request({
      url: `${unionApiUrl}/meetingReviewComments/deleteReviewComments?id=${data}`,
      method: 'post'
    })
  },

  /**
   * @description: 打印
   * @param {Object} data 接口参数
   * @return {Promise} 接口Promise
   */
  print: data => {
    return request({
      url: `${unionApiUrl}/meeting/print`,
      method: 'get',
      params: data
    })
  },
}